import Vue from 'vue'
import Vuex from 'vuex'
import a from './modules/a.js'
import b from './modules/b.js'
Vue.use(Vuex)

export default{
    state:()=>({

    }),
    getters:{},
    mutations:{},
    actions:{},
    modules:{
        a,
        b
    }
}


//使用模块中的内容
computed: {
    // 映射全局 state/getters
    ...mapState(['a/prop1', 'a/prop2']), // 需手动拼接模块路径
    ...mapGetters(['a/getter1', 'b/getter2'])
  },
  methods: {
    // 映射全局 mutations/actions
    ...mapMutations(['a/mutation1', 'b/mutation2']),
    ...mapActions(['a/action1', 'b/action2'])
  }

//直接通过this访问
this.prop1
this.prop2
this.getters1
this.getter2
this.mutation1()
this.mutation2()
this.action1()
this.action2()